package com.miaoxun.web.config;

import com.miaoxun.service.queue.Consumer;
import org.springframework.context.annotation.Configuration;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;

/**
 * servlet 启动
 * 依赖于容器
 */
@Configuration
@WebListener
public class MyListenerOnServlet implements ServletContextListener {
    @Override
    public void contextInitialized(ServletContextEvent servletContextEvent) {
        Consumer consumer = new Consumer();
        consumer.Consume();
    }

    @Override
    public void contextDestroyed(ServletContextEvent servletContextEvent) {

    }


}